{#

This file is part of the Sonata package.

(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

#}

<th{% if(is_diff|default(false)) %} class="diff"{% endif %}>
    {%- block name -%}
        {%- if field_description.label is not same as(false) -%}
            {%- if field_description.translationDomain is same as(false) -%}
                {{ field_description.label }}
            {%- else -%}
                {{ field_description.label|trans({}, field_description.translationDomain) }}
            {%- endif -%}
        {%- endif -%}
    {%- endblock -%}
</th>
<td>
    {%- block field -%}
        {% set collapse = field_description.option('collapse') %}
        {%- if collapse -%}
            <div class="sonata-readmore" {{ stimulus_controller('sonata-readmore', {
                'collapsedHeight': collapse.height|default(40),
                'moreText': collapse.more|default('read_more')|trans({}, 'SonataAdminBundle'),
                'lessText': collapse.less|default('read_less')|trans({}, 'SonataAdminBundle'),
            }) }}>
                <div class="sonata-readmore-content" {{ stimulus_target('sonata-readmore', 'content') }}>
                    {%- block field_value -%}
                        {% if field_description.option('safe', false) %}{{ value|raw }}{% else %}{{ value|default('')|nl2br }}{% endif %}
                    {%- endblock -%}
                </div>
                <button type="button"
                        class="sonata-readmore-btn btn-link"
                        {{ stimulus_target('sonata-readmore', 'button') }}
                        {{ stimulus_action('sonata-readmore', 'toggle', 'click') }}></button>
            </div>
        {%- else -%}
            {{- block('field_value') -}}
        {%- endif -%}
    {%- endblock -%}
</td>

{%- block field_compare -%}
    {%- if value_compare is defined -%}
        {% set value = value_compare %}
        {% set object = object_compare %}
        <td>{{- block('field') -}}</td>
    {%- endif -%}
{%- endblock -%}
